Skip to content

Keep original queryset on DjangoFilterConnectionField #816

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Nov 29, 2019

Conversation

bellini666
Copy link
Contributor

The PR #796 broke DjangoFilterConnectionField making it always get the
raw queryset from the model to apply the filters in it.

This makes sure that the DjangoObjectType's .get_queryset is called,
keeping any filtering it might have made.

====

I noted this when trying to update my extension (https://github.com/0soft/graphene-django-plus/tree/master/graphene_django_plus) to work with 2.7.0 and seeing some tests failing. There I override DjangoObjectType's get_queryset method to add some permissioning checks and my tests broke when a query that should only return some objects that the test user had access returned everything.

Fixes #815

The PR graphql-python#796 broke DjangoFilterConnectionField making it always get the
raw queryset from the model to apply the filters in it.

This makes sure that the DjangoObjectType's .get_queryset is called,
keeping any filtering it might have made.
@jkimbo
Copy link
Member

jkimbo commented Nov 29, 2019

Thanks for the quick PR @bellini666 . I've added a regression test and I'll release this as v2.7.1

@jkimbo jkimbo merged commit 7e7f18e into graphql-python:master Nov 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

DjangoFilterConnectionField ignoring DjangoObjectType's get_queryset
2 participants